package xyc.szk.web.servlet.request;
/*
 * @Description:
 * @Author: 山志凯
 * @Date: 2021-03-31
 * @Time: 08:20
 */

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/req02")
public class RequestDispather02 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //System.out.println("这个请求时是req01转发过来的");
        System.out.println("req02:" + req + "\nresp02" + resp);
        //获取响应器，用来向浏览器发送信息
        PrintWriter out = resp.getWriter();
        out.println("req02的响应信息");
        System.out.println("从request请求域中获取的参数"+req.getAttribute("username"));
    }
}